package com.atguigu.spring.tx.xml.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.atguigu.spring.tx.xml.dao.BookShopDao;



@Service
public class BookShopServiceImpl implements BookShopService {
	
	@Autowired
	private BookShopDao  bookShopDao ;
	
	
	public void buyBook(String username, String isbn) {
		
		Integer price = bookShopDao.findPriceByIsbn(isbn);
		
		bookShopDao.updateStock(isbn);
		
		bookShopDao.updateUserAccount(username, price);
		
	}
}
